@extends('layout.master')

@section('content')
    <div class="row">
        <div class="col-md-4">
            <div class="panel panel-info">
                <div class="panel-heading">
                    <h3 class="panel-title">
                        <a href="{{ route('list', ['id' => 1]) }}">新闻</a>
                    </h3>
                </div>
                <div class="panel-body">
                    <div class="list-group">
                        @foreach($lists1 as $list1)
                            <a href="{{ route('content', ['id' => $list1->id]) }}" class="list-group-item">
                                {{ $list1->title }}
                            </a>
                        @endforeach
                    </div>
                </div>
            </div>
        </div>
        <div class="col-md-4">
            <div class="panel panel-info">
                <div class="panel-heading">
                    <h3 class="panel-title"><a href="{{ route('list', ['id' => 2]) }}">最新文档</a></h3>
                </div>
                <div class="panel-body">
                    <div class="list-group">
                        @foreach($lists2 as $list2)
                            <a href="{{ route('content', ['id' => $list2->id]) }}" class="list-group-item">
                                {{ $list2->title }}
                            </a>
                        @endforeach
                    </div>
                </div>
            </div>
        </div>

        @include('layout.right')

    </div>
    <div class="row center-block">
        <div class="panel panel-info">
            <div class="panel-heading">
                <h3 class="panel-title">产品展示</h3>
            </div>
            <div class="panel-body">
                <div id="img1" style="overflow:hidden; width:1000px; height:150px;margin-left: auto;margin-right: auto;margin-bottom: 20px;" >
                    <table>
                        <tr>
                            @foreach($products as $product)
                                <td>
                                    <a href="javascript:void(0)">
                                        <img src="{{ asset('upload/'.$product->thumbnail) }}" style="width:200px; height:150px;" />
                                    </a>
                                </td>
                            @endforeach
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    </div>
@endsection

@section('script')
    <script type="text/javascript" src="{{ asset('js/fsrPMD.js') }}"></script>
    <script type="text/javascript">
        $(function () {
            $("#img1").fsrPMD({
                Event: 'mouseover',        //事件
                Id: 'img1',              //容器ID
                Bq: 'td',               //复制html标签
                Fx: "left",             //方向
                Time: 12             //时间
            })
            $('#img1 img').click(function () {
                var src = $(this).attr('src'),
                    content = '<img src="' + src + '" style="width: 600px;height: 600px;">';
                layer.open({
                    type: 1,
                    title: false,
                    closeBtn: 2,
                    area: ['600px', '600px'],
                    skin: 'layui-layer-nobg', //没有背景色
                    shadeClose: true,
                    content: content
                });
            });
        });
    </script>
@endsection